package com.shopping.miaosha.exceptionHander;

import com.shopping.miaosha.error.CommonError;

/**
 * @author canger
 * @Deseription
 * @create 2019/3/25 18:11
 **/
public class BusinessException extends Exception implements CommonError {

    private  CommonError commonError;


    public  BusinessException (CommonError commonError){
        super();
        this.commonError=commonError;
    }
    public  BusinessException (CommonError commonError,String errorMsg){
        super();
        this.commonError=commonError;
        this.commonError.setMsg(errorMsg);
    }
    @Override
    public int getCode() {
        return this.commonError.getCode();
    }

    @Override
    public String getMsg() {
        return this.commonError.getMsg();
    }

    @Override
    public CommonError setMsg(String errorMsg) {
       this.commonError.setMsg(errorMsg);
        return this;
    }
}
